import { createRouter, createWebHistory } from 'vue-router'
// 引入布局组件
import Layout from "@views/Layout"

const routes = [{
        path: '/',
        hidden: true,
        meta: {
            name: '主页'
        },
        redirect: { name: 'Login' }
    },
    {
        path: '/login',
        hidden: true,
        name: 'Login',
        meta: {
            name: '登录'
        },
        component: () =>
            import ('../views/Login')
    },
    {
        path: '/console',
        hidden: false,
        name: 'Console',
        meta: {
            name: '控制台',
            icon: 'console'
        },
        redirect: 'index',
        component: Layout,
        children: [{
            path: '/index',
            hidden: false,
            Name: 'Index',
            meta: {
                name: '首页'
            },
            component: () =>
                import ("@views/Console/index.vue")
        }]
    },
    {
        path: '/info',
        hidden: false,
        name: 'Info',
        meta: {
            name: '信息管理',
            icon: 'info'
        },
        component: Layout,
        children: [{
                path: '/infoList',
                hidden: false,
                Name: 'InfoList',
                meta: {
                    name: '信息列表'
                },
                component: () =>
                    import ("@views/Info/index.vue")
            },
            {
                path: '/category',
                hidden: false,
                Name: 'Category',
                meta: {
                    name: '信息分类'
                },
                component: () =>
                    import ("@views/Info/category.vue")
            }
        ]
    },
    {
        path: '/user',
        hidden: false,
        name: 'User',
        meta: {
            name: '用户管理',
            icon: 'user'
        },
        component: Layout,
        children: [{
            path: '/userList',
            hidden: false,
            Name: 'UserList',
            meta: {
                name: '用户列表'
            },
            component: () =>
                import ("@views/User/index.vue")
        }]
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router